﻿<%@ Page Language="C#" MasterPageFile="~/TeamManager.Master" AutoEventWireup="true" CodeBehind="EntityManagement.aspx.cs" Inherits="NWS.EntityManagement" Title="Entity management" %>

<%@ Register Assembly="NWS" Namespace="NWS" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyContentPlaceHolder" runat="server">
  <cc1:InsertableGrid ID="InsertableGrid1" runat="server" AllowInsert="True" 
    AutoGenerateColumns="False" DataSourceID="EntitiesDataSource" 
    CellPadding="4" ForeColor="#333333" GridLines="None" DataKeyNames="ID">
    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
    <Columns>
      <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" 
        ReadOnly="True" Visible="False" />
      <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
      <asp:BoundField DataField="Description" HeaderText="Description" 
        SortExpression="Description" />
      <asp:TemplateField HeaderText="Entity Type" SortExpression="EntityTypeID">
        <ItemTemplate>
          <asp:Label ID="Label1" runat="server" Text='<%# Bind("EntityTypeName") %>'></asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
          <asp:DropDownList ID="ddlEntityTypes" runat="server" 
            DataSourceID="EntityTypesDataSource" DataTextField="Name" DataValueField="ID"
            SelectedValue='<%# Bind("EntityTypeID") %>'>
          </asp:DropDownList>
        </EditItemTemplate>
      </asp:TemplateField>
      <asp:CommandField InsertVisible="False" ShowDeleteButton="True" 
        ShowEditButton="True" />
    </Columns>
    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <EditRowStyle BackColor="#999999" />
    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
  </cc1:InsertableGrid>
  <asp:ObjectDataSource ID="EntitiesDataSource" runat="server" 
    SelectMethod="GetTeamEntityList" TypeName="Dzzzr.Entity" 
    OldValuesParameterFormatString="{0}" 
    InsertMethod="InsertEntity" DeleteMethod="DeleteEntity">
    <DeleteParameters>
      <asp:Parameter Name="ID" Type="Int32" />
    </DeleteParameters>
    <SelectParameters>
      <asp:ProfileParameter DefaultValue="0" Name="TeamID" PropertyName="TeamID" 
        Type="Int32" />
    </SelectParameters>
    <InsertParameters>
      <asp:ProfileParameter DefaultValue="0" Name="TeamID" PropertyName="TeamID" 
        Type="Int32" />
      <asp:Parameter Name="Name" Type="String" />
      <asp:Parameter Name="Description" Type="String" />
      <asp:Parameter Name="EntityTypeID" Type="Int32" />
    </InsertParameters>
  </asp:ObjectDataSource>
  <asp:ObjectDataSource ID="EntityTypesDataSource" runat="server" 
    SelectMethod="GetEntityTypes" TypeName="Dzzzr.EntityType" 
    OldValuesParameterFormatString="original_{0}">
  </asp:ObjectDataSource>
</asp:Content>
